# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: Matthew Bowra-Dean <matthew@ijw.co.nz>
pkgname=openra
pkgver=20231010
pkgrel=2
pkgdesc="An open-source implementation of the Red Alert engine using .NET/Mono and OpenGL"
arch=('any')
url="https://www.openra.net"
license=('GPL3')
install=openra.install
depends=('ttf-dejavu' 'openal' 'libgl' 'freetype2' 'sdl2' 'lua51' 'hicolor-icon-theme'
         'gtk-update-icon-cache' 'desktop-file-utils' 'xdg-utils' 'zenity' 'dotnet-runtime-6.0')
makedepends=('git' 'unzip' 'dotnet-sdk-6.0')
options=(!debug)
source=("git+https://github.com/OpenRA/OpenRA.git#tag=release-${pkgver}")
sha512sums=('SKIP')

prepare() {
  cd OpenRA

  make version VERSION="release-${pkgver}"
}

build() {
  cd OpenRA

  make RUNTIME=net6 TARGETPLATFORM=unix-generic
}

package() {
  cd OpenRA
  mkdir -p "$pkgdir/usr/lib/openra/"
  cp -r bin/* "$pkgdir/usr/lib/openra/"
  source ./packaging/functions.sh
  install_data . "$pkgdir/usr/lib/openra/" cnc d2k ra
  make prefix=/usr DESTDIR="$pkgdir" install-linux-shortcuts
  make prefix=/usr DESTDIR="$pkgdir" install-linux-appdata
  # make prefix=/usr DESTDIR="$pkgdir" install-man
}
